<template>
	<uni-popup ref="popupRef" type="center" :safe-area="false">
		<view class="main">
			<view class="title">
				创建心愿
			</view>
			<view class="content">
				确认创建后，分享你的心愿给好友可以加速达成哦！
			</view>
			<view class="btn">
				<view class="btn-item" @click="close">
					取消
				</view>
				<view class="btn-item" @click="onWish">
					确认
				</view>
			</view>
		</view>
	</uni-popup>
</template>

<script setup>
	import {
		reactive,
		ref,
		computed,
		watchEffect
	} from 'vue'
	import {
		onReady,
		onLoad
	} from '@dcloudio/uni-app'
	import {
		postHttpApi
	} from "@/api/base"
	const popupRef = ref(null)
	const goods_id = ref(null)
	const close = () => {
		popupRef.value.close()
	}
	const open = (id) => {
		goods_id.value = id
		popupRef.value.open()
	}
	defineExpose({
		close,
		open
	})
	const onWish = () => {
		postHttpApi('&route=group-buying.promise&type=5&mid=4', {
			goods_id: goods_id.value
		}).then(res => {
			uni.showToast({
				title:'许愿成功',
				icon:'none'
			})
			close()
		})

	}
</script>

<style lang="scss" scoped>
	.main {
		width: 460rpx;
		height: 368rpx;
		padding: 68rpx 50rpx 70rpx;
		background-image: url('../../static/bg2.png');
		background-size: 100% 100%;
	}

	.title {
		font-weight: 700;
		font-size: 40rpx;
		color: #000000;
		line-height: 48rpx;
		text-align: center;
		margin-bottom: 68rpx;
	}

	.content {
		font-weight: 400;
		font-size: 28rpx;
		color: #3D3D3D;
		line-height: 48rpx;
		text-align: center;
		width: 342rpx;
		margin: auto;
	}

	.btn {
		display: flex;
		justify-content: space-between;
		margin-top: 74rpx;

		&-item {
			width: 224rpx;
			height: 80rpx;
			border-radius: 200rpx;
			line-height: 80rpx;
			text-align: center;
			font-weight: 400;
			font-size: 28rpx;
			color: #FFFFFF;
		}

		&-item:nth-child(1) {
			background: #D6D6D6;
		}

		&-item:nth-child(2) {
			background: #F04E2A;
		}
	}
</style>